package com.gwcloud.design.create.factory.factory;

/** 
* @ClassName   : FruitsFactory 
* @author      : ganwei 
* @date        : 2020年6月28日 
* @Description : 工厂模式 
*/
public class FruitsFactory {
	/**
	 * 购买水果
	 * @param name
	 * @return Shop
	 */
	public Fruits purchaseFruits(String name){
		if("Apple".equals(name)){
			// 苹果
			return new Apple();
		}else if("Banana".equals(name)){
			// 香蕉
			return new Banana();
		}
		return null;
	}
	
	
	/**
	 * -主函数
	 */
	public static void main(String[] args) {
        FruitsFactory factory = new FruitsFactory();
        Fruits apple = factory.purchaseFruits("Apple");
        apple.describe();
        
        Fruits banana = factory.purchaseFruits("Banana");
        banana.describe();
	}
}
